#AM_CFLAGS = -g -O2 -Wall -Werror  -Wno-deprecated-declarations -fno-strict-aliasing -std=gnu99 -D_GNU_SOURCE
#AM_CFLAGS = -g -O2 -Wall -Werror  -Wno-deprecated-declarations
AM_CFLAGS =

AM_CFLAGS += -I$(top_srcdir)/libjansson
AM_CFLAGS += -I$(top_srcdir)/libhiredis
AM_CFLAGS += -I$(top_srcdir)/libsqlite
AM_CFLAGS += -I/usr/include/glib-2.0
AM_CFLAGS += -I/usr/lib/x86_64-linux-gnu/glib-2.0/include

COMMON_LIBS = 
COMMON_LIBS  += $(top_builddir)/libjansson/libjansson.la
COMMON_LIBS  += $(top_builddir)/libhiredis/libhiredis.la
COMMON_LIBS  += $(top_builddir)/libsqlite/libsqlite3.la

COMMON_LIBS += -lssl -lcrypto -lcurl -lprotobuf-c
COMMON_LIBS += -L/usr/lib/x86_64-linux-gnu -lglib-2.0
#COMMON_LIBS  += -L$(top_builddir)/type/protobuf-c -lprotobuf-c


#demo/dummy.c
bin_PROGRAMS  = PRCToken
PRCToken_SOURCES = demo/prctoken.c \
                   demo/main.c \
                   demo/util.c  \
                   abci/abci.c \
                   abci/dispose.c \
                   abci/size.c \
                   dlist/dlist.c \
                   encoding/bigEndian.c \
                   encoding/littleEndian.c \
                   encoding/bits.c \
                   socket/socket_io.c \
                   socket/socket_tcp.c \
                   type/message.c \
                   type/request_struct.c \
                   type/response_struct.c \
                   type/types.pb-c.c \
                   validator/pear_validator.c \
                   account/pear_account.c \
                   transaction/pear_base64.c \
                   transaction/pear_tx_default.c \
                   transaction/pear_tx_ctx.c \
                   transaction/pear_tx_serial.c \
                   crypto/pear_key.c \
                   crypto/pear_keystore.c \
                   store/pear_kv_store.c \
                   store/pear_kv_GHashTable.c \
                   store/pear_kv_redis.c \
                   store/pear_redis.c \
                   utils/pear_curl.c \
                   utils/pear_json.c \
                   utils/pear_dump.c \
                   block/pear_block_ctx.c \
                   block/pear_block.c

PRCToken_CFLAGS  = $(AM_CFLAGS)
PRCToken_LDADD   = $(COMMON_LIBS)

bin_PROGRAMS  += txcli

txcli_SOURCES = transaction/pear_send_tx.c \
                transaction/pear_base64.c \
                transaction/pear_tx_ctx.c \
                transaction/pear_tx_default.c \
                transaction/pear_tx_serial.c \
                crypto/pear_key.c \
                crypto/pear_keystore.c \
                utils/pear_curl.c \
                utils/pear_json.c \
                utils/pear_dump.c \
                account/pear_account.c \
                store/pear_kv_store.c \
                store/pear_kv_GHashTable.c \
                store/pear_kv_redis.c \
                store/pear_redis.c

txcli_CFLAGS = $(AM_CFLAGS)
txcli_LDADD  = $(COMMON_LIBS)


bin_PROGRAMS  += kstest

kstest_SOURCES = crypto/pear_key.c \
                 crypto/pear_keystore.c \
                 crypto/pear_keystore_test.c \
                 utils/pear_json.c \
                 utils/pear_dump.c

kstest_CFLAGS  = $(AM_CFLAGS)
kstest_LDADD   = $(COMMON_LIBS)


bin_PROGRAMS  += kvtest

kvtest_SOURCES = store/pear_kv_store.c \
                 store/pear_kv_redis.c \
                 store/pear_kv_GHashTable.c \
                 store/pear_kv_store_test.c \
                 store/pear_redis.c

kvtest_CFLAGS  = $(AM_CFLAGS)
kvtest_LDADD   = $(COMMON_LIBS)

bin_PROGRAMS  += accli

accli_SOURCES = account/pear_account.c \
                account/pear_add_account.c \
                crypto/pear_key.c \
                crypto/pear_keystore.c \
                utils/pear_json.c \
                utils/pear_dump.c \
                store/pear_kv_store.c \
                store/pear_kv_redis.c \
                store/pear_kv_GHashTable.c \
                store/pear_redis.c

accli_CFLAGS  = $(AM_CFLAGS)
accli_LDADD   = $(COMMON_LIBS)



